<?php
class SitemapsController extends AppController {

    var $components = array('RequestHandler');
    var $helpers = array('Time', 'Xml','Rss');
    var $name = 'Sitemaps';
    var $uses   = array('Post');

    function beforeFilter(){
        parent::beforeFilter();
        $this->Auth->allow('freelogo','sitemap','comment');
    }

    /**
     * Generating sitemap for indexing
     */
    function sitemap ()
    {
        Configure::write ('debug', 0);
        $posts = $this->Post->getPostForSitemap();
        $this->set(compact('posts'));
        $this->RequestHandler->respondAs('xml');
        $this->viewPath .= '/xml';
        $this->layoutPath = 'xml';
    }

    /**
     * Feed Logo RSS
     * routes : /freelogo.rss
     */
    function freelogo()
    {
          Configure::write ('debug', 0);
          $this->set('posts', $this->Post->getFeed());
    }

    /**
     * Feed Comment RSS
     * routes : /comment.rss
     */
    function comment()
    {
          Configure::write ('debug', 0);
          $this->set('comments', $this->Post->Comment->getFeedComments());
    }
}
?>
